<?php
require_once LIBPATH.'core/AbsController.php';
require_once CLSPATH.'Exception.php';
class FX_Controller extends AbsController { 
	
	public $user_seq;
	public $user_login_id;
	public $user_name;
	
	/**
	 * Constructor
	 *
	 * Calls the initialize() function
	 */
	function __construct()
	{	
		parent::__construct();
		$this->load->library('session');
		$this->db = $this->load->database('default', TRUE, TRUE);
		$this->load->helper('url');
		$this->tpl->assign('session', $this->session->userdata);
	}

	final protected function isLogin()
	{
		if(isset($this->session->userdata['user_seq']))
		{
			$this->user_seq = $this->session->userdata['user_seq'];
			$this->user_name = $this->session->userdata['user_name'];
			$this->user_login_id = $this->session->userdata['user_login_id'];
			return true;
		}
		return false;
	}
	
	final protected function loginPage()
	{
		$this->redirect("/login/index/?backurl=".urlencode(str_replace('//', '/', '/'.$this->uri->uri_string.'/')));
	}
	
	final protected function error($exception)
	{
		exit($exception->getMessage());
	}
}